import request from "@/utils/request";

const _BASE_URL = "/biz/blueprint/designer";

const BlueprintDesignerAPI = {

  getPage(queryParams: BlueprintDesignerPageQuery) {
    return request<any, PageResult<BlueprintDesignerPageVO[]>>({
      url: `${_BASE_URL}/pages`,
      method: "get",
      params: queryParams,
    });
  },

  /**
   * 保存数据
   *
   * @param data 数据表单数据
   */
  save(data: BlueprintDesignerForm) {
    return request({
      url: `${_BASE_URL}/save`,
      method: "post",
      data: data,
    });
  },
  
  /**
   * 删除数据
   *
   * @param ids 数据源ID，多个以英文逗号(,)分隔
   */
  deleteByIds(ids: string) {
    return request({
      url: `${_BASE_URL}/${ids}`,
      method: "delete",
    });
  },
  
  /**
   * 保存数据
   *
   * @param data 数据表单数据
   */
  saveContent(data: any) {
    return request({
      url: `${_BASE_URL}/save/content`,
      method: "post",
      data: data,
    });
  },
  
  getContentById(id:any) {
    return request<any, any>({
      url: `${_BASE_URL}/content/${id}`,
      method: "get",
    });
  },
  
};

export default BlueprintDesignerAPI;

/**
 * 数据查询参数
 */
export interface BlueprintDesignerPageQuery extends PageQuery {
  /**
   * 关键字(数据名称)
   */
  keywords?: string;
}

export interface BlueprintDesignerPageVO {
	/*创建人 */
	createUserId: string;

	/*更新人 */
	updateUserId: string;

	/*更新时间 */
	updateTime: Date;

	/*备注信息 */
	remark: string;

	/*是否发布(0-未发布|1-已经发布) */
	isRelease: string;

	/* */
	name: string;

	/*主键 */
	id: string;

	/*创建时间 */
	createTime: Date;
}

// 定义接口
export interface BlueprintDesignerForm {
  /*备注信息 */
  remark?: string;

  /*是否发布(0-未发布|1-已经发布) */
  isRelease?: string;

  /* */
  name?: string;

  /*主键 */
  id?: string;
}